<include file="Public:index_header" />
<div class="area-category">
    <div class="title">
        <span>群众信箱</span>
    </div>
    <div class="list">
        <table class="gridview" width="100%">
            <tr>
                <th width="15%" class="tl">分类：</th>
                <td class="tl">
                    <select name="category">
                        <option value="">-- 请选择分类 --</option>
                        <volist name="category" id="vo">
                            <option value="{$vo.id}">{$vo.name}</option>
                        </volist>
                    </select>
                </td>
            </tr>
            <tr>
                <th class="tl">姓名<span class="required">*</span>：</th>
                <td class="tl">
                    <input type="text" name="name" />
                </td>
            </tr>
            <tr>
                <th class="tl">联系电话：</th>
                <td class="tl"><input type="text" name="phone" /></td>
            </tr>
            <tr>
                <th class="tl">联系地址：</th>
                <td class="tl"><input type="text" name="addr" /></td>
            </tr>
            <tr>
                <th class="tl">Email：</th>
                <td class="tl"><input type="text" name="email" /></td>
            </tr>
            <tr>
                <th class="tl">主题<span class="required">*</span>：</th>
                <td class="tl"><input type="text" name="title" /></td>
            </tr>
            <tr>
                <th class="tl">详细内容<span class="required">*</span>：</th>
                <td class="tl"><textarea name="content"></textarea></td>
            </tr>
            <tr>
                <th class="tl"></th>
                <td class="tl" style="padding:10px;">
                    <button onclick="leaveMsg();" class="btn btn-page" style="margin-right:10px;">提 交</button>
                    <button onclick="location.href='/Home/index/msg'" class="btn btn-page">返回群众信箱</button>
                </td>
            </tr>
        </table>

    </div>
</div>
<script>
    function leaveMsg() {
        var name = $("input[name=name]").val();
        var phone = $("input[name=phone]").val();
        var addr = $("input[name=addr]").val();
        var email = $("input[name=email]").val();
        var title = $("input[name=title]").val();
        var content = $("textarea[name=content]").val();
        var category = $("select[name=category]").val();
        if(!category){
            alert("分类不能为空");
            return false;
        }
        if(!name){
            alert("姓名不能为空");
            return false;
        }
        if(!title){
            alert("标题不能为空");
            return false;
        }
        if(!content){
            alert("详细内容不能为空");
            return false;
        }
        $.ajax({
            url:"/home/index/ajax_LeaveMsg",
            data: {name:name, phone:phone, addr:addr, email:email,
                title:title, content:content,category:category},
            type:"POST", dataType:"JSON",
            success: function(data){
                if(data.status){
                    alert("您的信件已收到，请等待回复")
                }else{
                    alert(data.info);
                }
            }
        });
    }
</script>
<include file="Public:index_footer" />